﻿@{
    ViewBag.Title = "商拓软件科技_找回密码";
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/reset.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/style.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-darkgray.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-green.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-skyblue.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-twitter.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-violet.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-yellow.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-yellowsimple.css">
    <link href="@Url.Content("~/Scripts/miniui/themes/default/miniui.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Scripts/miniui/themes/icons.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Scripts/miniui/themes/jqueryui-cupertino/skin.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/miniui/miniui.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/themes/kingcens/js/jquery.tooltip.js")" type="text/javascript"></script>
</head>
<body>
    <div class="hander">
        <div class="hander-center">
            <a href="#" class="logo" title="logo">
                <img src="@ViewBag.logo"></a>
        </div>
    </div>
    <div class="min">
        <div class="content-layout">
            <div class="login-box-warp1">
                <div class="login-title"><span>找回密码</span></div>
                <div class="static-form">
                    <form role="form" id="form1" action="@Url.Action("RetrievePassword")" method="post"  onClick="return submitForm()">
                        <div class="username-field">
                            <label class="username"></label>
                            <span>
                                <input class="login-name" type="text" name="username" id="username" value="@ViewBag.username" onclick="clearError" placeholder="请输入手机号码" msg="手机号码不正确!"></span>
                        </div>
                        <div class="field code-field">
                            <label class="userpwd"></label>
                            <span>
                                <input class="logo-pwd code-wid" type="text" name="identify" id="identify" onclick="clearError" value="@ViewBag.vcode" placeholder="验证码" autoComplete="off" msg="请输入验证码！"></span>
                            <button class="code_time">获取验证码</button>
                        </div>
                        <div class="submit-bnt" style="margin-top: 15px;">
                            <button class="btn">下一步</button>
                        </div>
                        <!--<div class="copy-info">当前版本 <em>v6.1.2.0</em></div>-->
                        <input type="hidden" name="error" id="error" value="@ViewBag.error" />
                        <input type="hidden" name="errorCode" id="errorCode" value="@ViewBag.errorCode" />
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="footer">
        <div class="foot-center clearfix">
            <div class="foot-info">
                <p class="name">@ViewBag.corpname</p>
                <p class="link">官方网址:<a href="@ViewBag.url" target="_blank">@ViewBag.url</a></p>
            </div>
        </div>

    </div>
    <script>
        function initalusername(msg) {
            if (msg != "")
                $("#username").attr("msg", msg);
            $('#username').poshytip({
                className: 'tip-twitter',
                showOn: 'focus',
                alignTo: 'target',
                alignX: 'center',
                alignY: 'bottom',
                offsetX: 0,
                offsetY: 5
            });
        }
        function initalidentify(msg) {
            if (msg != "")
                $("#identify").attr("msg", msg);
            $('#identify').poshytip({
                className: 'tip-twitter',
                showOn: 'focus',
                alignTo: 'target',
                alignX: 'inner-left',
                offsetX: 0,
                offsetY: 5
            });
        }
        function clearError() {
            $(".identify").html("");
        }
        var ck = "";
        $(function () {
            initalusername('');
            initalidentify();
            mini.parse();

            $("#username").click(function () {
                $("#username").poshytip("disable");
            });
            $("#identify").click(function () {
                $("#identify").poshytip("disable");
            });
            if ($("#identify").val() != "") {
                $(".code_time").attr({ "disabled": "disabled" });
                $(".code_time").click(function () {
                    mini.showTips({ content: "验证码已已存在。", state: "danger", x: "center", y: "top", timeout: 5000 });
                });
            }
            else {
                $(".code_time").click(function () {
                    ck = "";
                    var reg = /^1[0-9]{10}$/;
                    var phoneNum = $("#username").val();
                    var flag = reg.test(phoneNum);
                    if (!flag) {
                        mini.showTips({ content: "请输入正确的手机号码！", state: "danger", x: "center", y: "top", timeout: 5000 });
                        return;
                    }
                    $.post("../Home/GetVerifyCode", { phone: phoneNum }, function (data) {
                        var mdata = mini.decode(data);
                        if (mdata.code == 1) {
                            mini.showTips({ content: "验证码已发送到你的手机，请注意查看。" + mdata.icode, state: "success", x: "center", y: "top", timeout: 5000 });
                            timer();
                            $(".code_time").attr({ "disabled": "disabled" });
                        }
                        else {
                            mini.showTips({ content: mdata.msg, state: "danger", x: "center", y: "top", timeout: 10000 });
                        }
                    });
                });
            }
            $(".btn").click(function () { ck = "submit"; });
            if ($("#error").val() != "") {
                var data = JSON.parse($("#error").val());
                if (data.success == 1) {
                    window.location.href = "../User/ReinstallPassword";
                }
                else {
                    mini.showTips({ content: data.msg, state: "danger", x: "center", y: "top", timeout: 5000 });
                }
            }
        });

        var time = 60;
        function timer() {
            $(".code_time").html("还剩" + time + "秒");
            time--;
            if (time > 0)
                setTimeout(timer, 1000);
            else {
                time = 60;
                $(".code_time").html("获取验证码");
                $(".code_time").removeAttr("disabled");
            }
        }
        function submitForm() {
            if (ck == "submit") {
                $(".identify").html("");
                var reg = /^1[0-9]{10}$/;
                var phoneNum = $("#username").val();
                var retvalue = true;
                var flag = reg.test(phoneNum);
                if (!flag && retvalue) {
                    $("#username").poshytip("enable");
                    $('#username').poshytip('show');
                    retvalue = false;
                }
                if ($("#identify").val() == "") {
                    $("#identify").poshytip("enable");
                    $('#identify').poshytip('show');
                    retvalue = false;
                }
                ck = "";
                if (retvalue)
                    return true;
                else {
                    $(".identify").css("display", "block");
                    return false;
                }
            } else {
                return false;
            }
        }
    </script>
</body>
